land_analysis()
information_delivery()
map_data()
business_type()
base_data()
middle_data()
setInterval(land_analysis, 1000 * 2)
setInterval(information_delivery, 1000 * 2)
setInterval(business_type, 1000 * 2)
setInterval(base_data, 1000 * 2)
setInterval(middle_data, 1000 * 2)

function middle_data() {
    $.ajax({
        url: "/data_api/middle_data",
        success: function(data) {
            var total_information = data.source.total_information;
            var today_information = data.source.today_information;
            $("#total_information").text(total_information);
            $("#today_information").text(today_information);
            var total_transaction_money = data.source.total_transaction_money;
            var today_transaction_money = data.source.today_transaction_money;
            $("#total_transaction_money").text(total_transaction_money);
            $("#today_transaction_money").text(today_transaction_money);
            var total_transaction_area = data.source.total_transaction_area;
            var today_transaction_area = data.source.today_transaction_area;
            $("#total_transaction_area").text(total_transaction_area);
            $("#today_transaction_area").text(today_transaction_area);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}
function base_data() {
    $.ajax({
        url: "/data_api/base_data",
        success: function(data) {
            var total_confirmation_area = data.source.total_confirmation_area;
            var total_circulation_area = data.source.total_circulation_area;
            var total_expect_area = data.source.total_expect_area;
            $("#total_confirmation_area").text(total_confirmation_area);
            $("#total_circulation_area").text(total_circulation_area);
            $("#total_expect_area").text(total_expect_area);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}

function business_type() {
    $.ajax({
        url: "/data_api/business_type",
        success: function(data) {
            option1.series[0].data = data.source;
            option1.legend.data = data.legend_name;
            myChart1.setOption(option1);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}
function land_analysis() {
    $.ajax({
        url: "/data_api/land_analysis",
        success: function(data) {
            option2.dataset.source = data.source;
            myChart2.setOption(option2);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}

function information_delivery() {
    $.ajax({
        url: "/data_api/information_delivery",
        success: function(data) {
            option3.dataset.source = data.source;
            myChart3.setOption(option3);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}

function map_data() {
    $.ajax({
        url: "/data_api/map_data",
        method: 'POST',
        data: {},
        success: function(data) {
            option4.series[0].data = data.source;
            new Highcharts.Map('map', option4);
        },
        error: function(xhr, type, errorThrown) {
        }
    })
}
